home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / BACKUP / FORAG100.ZIP;1 / FORAGE.DOC < prev    next >
Encoding:
Text File  |  1994-01-01  |  13.3 KB  |  344 lines

  1. ===============================================================================
  2. =================                                             =================
  3. =================   USER  MANUAL  FOR  THE  FORAGE  COMMAND   =================
  4. =================                                             =================
  5. ===============================================================================
  6.  
  7.  
  8.  
  9.  
  10.              The FORAGE ("For Age") program is Copyright (C) 1992
  11.  
  12.                                       by
  13.  
  14.          Pinnacle Software, CP 386 Mount Royal, Quebec Canada  H3P 3C6
  15.          U.S. Office: Box 714 Airport Road, Swanton, Vermont 05488 USA
  16.  
  17.                     Customer Support Service (514) 345-9578
  18.                     Free 9600 bps files BBS  (514) 345-8654
  19.  
  20.  
  21.  
  22.  
  23.                                     -==*==-
  24.  
  25.  
  26.  
  27.  
  28.                          Created for Pinnacle Software
  29.  
  30.                                       by
  31.  
  32.       Timothy Campbell, 1250 Laird #1A, Montreal, Quebec, Canada H3P 2T2
  33.  
  34.  
  35.  
  36.  
  37. ===============================================================================
  38. OVERVIEW
  39. ===============================================================================
  40.  
  41.  
  42. FORAGE  lets you find the  name  of the newest (or oldest) file in a directory,
  43. and pass that name to a DOS command.   This may not be something you have to do
  44. every day, but when you need to do it, you'll discover that DOS doesn't have an
  45. easy method to do that kind of thing.  Usually you end up doing a  DIR  (sorted
  46. by date, perhaps) and reading through it until you find the file you want.  But
  47. so many jobs are date- and time-dependant that we need a utility like FORAGE to
  48. let us automate these tasks.
  49.  
  50. TO INSTALL FORAGE:   Copy all of the files in the FORAGE package to a directory
  51. that is located in your  DOS PATH.  For details about the PATH command, consult
  52. your DOS manual.
  53.  
  54.  
  55.  
  56. ===============================================================================
  57. HOW FORAGE WORKS
  58. ===============================================================================
  59.  
  60.  
  61. NOTE:  This tutorial assumes you understand the use of wildcards in file masks.
  62.        For example, the DOS command  DIR *.DAT  uses the "*" wildcard character
  63.        to show a directory of all files with a DAT extension.  For more details
  64.        about wildcards, consult your DOS manual.
  65.  
  66. FORAGE  is a DOS command  which accepts  command-line parameters.  The simplest
  67. application is as follows:
  68.  
  69.   FORAGE N *.*
  70.  
  71. When you type this command at the DOS prompt,  FORAGE tells you the name of the
  72. newest file in  the current directory.   (Later on,  we'll see how you can pass
  73. that filename to another DOS command.)
  74.  
  75. The "N" stands for "Newest".  You can replace it with "O", as follows:
  76.  
  77.   FORAGE O *.*
  78.  
  79. This would tell you the name of the oldest file in the current directory.
  80.  
  81. If you also needed to know the  size  of the oldest file, you could have FORAGE
  82. call the DIR command, as follows:
  83.  
  84.   FORAGE O *.* DIR
  85.  
  86. One frequent requirement in business is to move old data to diskette.   You can
  87. copy the oldest file to a diskette as follows:
  88.  
  89.   FORAGE O *.* COPY @@ A:
  90.  
  91. The @@ means "the file you found".  If @@ is not specified,  it is assumed that
  92. it goes at the end of the command.  Thus, the following two commands are equiv-
  93. alent:
  94.  
  95.   FORAGE N *.* DIR
  96.   FORAGE N *.* DIR @@
  97.  
  98. Getting back to the example of saving  old data  to diskette,  you'll find that
  99. operations of that nature are  very easy to do  when you use FORAGE  in a batch
  100. (.BAT) file.  For a detailed example, showing how to move old data to diskette,
  101. consult the section entitled "SAMPLE BATCH FILES".
  102.  
  103. Some additional examples are given later on.  See "MORE EXAMPLES".
  104.  
  105.  
  106.  
  107. ===============================================================================
  108. COMMAND DEFINITION
  109. ===============================================================================
  110.  
  111.  
  112. The FORAGE command uses any of these formats:
  113.  
  114.  
  115.   FORAGE age mask
  116.   FORAGE age mask command
  117.   FORAGE age mask command pre-fname
  118.   FORAGE age mask command @@ post-fname
  119.   FORAGE age mask command pre-fname @@ post-fname
  120.  
  121.  
  122. In standard notation, the formal definition is as follows:
  123.  
  124.  
  125.   FORAGE age mask [ command [pre-fname] @@ [post-fname] ]
  126.  
  127.  
  128. The parameters are:
  129.  
  130.  
  131.   age        Age specification, either [N]ewest or [O]ldest
  132.              You can use a full word, but only the first letter is checked
  133.  
  134.  
  135.   mask       File mask, using wildcards, to set the range of files to check
  136.              For example, *.DAT checks all files with an extension of DAT
  137.              For details about wildcards, consult your DOS manual
  138.  
  139.  
  140.   command    DOS command (fully qualified, or in current PATH)
  141.              If none given, reports the name of file on console
  142.  
  143.  
  144.   pre-fname  Command-line parameters to pass BEFORE the filename
  145.  
  146.  
  147.   @@         Indicates where the filename goes when calling the command
  148.              If @@ is not specified, the filename is assumed to go last
  149.  
  150.  
  151.   post-fname Command-line parameters to pass AFTER the filename
  152.  
  153.  
  154.  
  155. ===============================================================================
  156. MORE EXAMPLES
  157. ===============================================================================
  158.  
  159.  
  160. EXAMPLE:     FORAGE
  161. FUNCTION:    Displays two help screens, explaining how to use FORAGE
  162.  
  163.  
  164. EXAMPLE:     FORAGE O *.*
  165. FUNCTION:    Displays the name of the oldest file in the directory
  166.  
  167.  
  168. EXAMPLE:     FORAGE N *.*
  169. FUNCTION:    Displays the name of the newest file in the directory
  170.  
  171.  
  172. EXAMPLE:     FORAGE N C:\DOS\*.*
  173. FUNCTION:    Displays the name of the newest file in the directory C:\DOS\
  174.  
  175.  
  176. EXAMPLE:     FORAGE N C:\DOS\*.EXE
  177. FUNCTION:    Displays the name of the newest EXE file in the directory C:\DOS\
  178.  
  179.  
  180. EXAMPLE:     FORAGE O *.DAT DEL
  181. FUNCTION:    Deletes the oldest file in the directory with a DAT extension
  182.  
  183.  
  184. EXAMPLE:     FORAGE O \DATA\*.DAT DEL
  185. FUNCTION:    Deletes oldest DAT file in \DATA\ directory of the current drive
  186.  
  187.              
  188. EXAMPLE:     FORAGE N C:\TEXT\*.TXT MYBATCH.BAT
  189. FUNCTION:    Passes the name of the newest TXT file in C:\TEXT\ to the batch
  190.              file MYBATCH.BAT (where it is accessible as the symbol %1)
  191.  
  192.  
  193. EXAMPLE:     FORAGE O *.DAT C:\MYPGMS\COPYOLD.EXE /v @@ /d/r
  194. FUNCTION:    Passes the name of the oldest DAT file to the COPYOLD program,
  195.              along with some command-line parameters before and after the
  196.              filename.  If the oldest file was named MYDATA.DAT, it would be
  197.              as if you typed this command:   COPYOLD /v MYDATA.DAT /d/r
  198.  
  199.  
  200. EXAMPLE:     FORAGE newest *.* testnew @@ -x -y
  201. FUNCTION:    Passes the name of the newest file to the testnew program,
  202.              followed by the command-line parameters.  If the oldest file
  203.              was named MYFILE.TXT, it would be as if you typed this command:
  204.              testnew MYFILE.TXT -x -y
  205.  
  206.  
  207.  
  208. ===============================================================================
  209. RETURN CODES
  210. ===============================================================================
  211.  
  212.  
  213. When you use FORAGE in a batch file, you should use "IF ERRORLEVEL" to check if
  214. the utility actually found a file.
  215.  
  216.  
  217. +-----------------------------------------------------------------------------+
  218. | **IMPORTANT**  When using "IF ERRORLEVEL", you MUST check the higher values |
  219. | first!  In other words,  check  255  before 1,  and  1  before  0.  This is |
  220. | because of the way "IF ERRORLEVEL" works.  See your DOS manual for details. |
  221. +-----------------------------------------------------------------------------+
  222.  
  223.  
  224. FORAGE sets ERRORLEVEL as follows:
  225.  
  226.  
  227.   ERRORLEVEL  REASON
  228.   ----------  ------
  229.  
  230.        0      No problems -- file was found
  231.  
  232.        1      No file was found to match the mask
  233.  
  234.      255      Program error, or help screen
  235.  
  236.  
  237.  
  238. ===============================================================================
  239. SAMPLE BATCH FILES
  240. ===============================================================================
  241.  
  242. NOTE:  This is  not a tutorial  for  batch file programming.   To find out more
  243.        about this  useful,  powerful  feature of DOS,  consult your DOS manual.
  244.        If you  plan to do any batch programming,  you  should  obtain a copy of
  245.        our  "SEE Utilities".   These can be  obtained  from our support BBS, or
  246.        can be  ordered  as  part  of our  "Amazing Shareware Promotion".   View
  247.        or print the text file AMAZE.DOC (included with FORAGE) for details.
  248.  
  249. The FORAGE package includes several sample batch files.  These can be viewed or
  250. edited with a standard text editor program  (e.g. DOS EDIT, or a word-processor
  251. in generic "DOS Text" mode).  These batch files are provided for  study  rather
  252. than for immediate use.  But with a few minor modifications,  you may find that
  253. they're just what you need!  The batch files are:
  254.  
  255.   SAVEOLD.BAT   Copies the oldest file in the directory with a DAT extension
  256.                 to a diskette, then deletes the file.
  257.  
  258.   SAFE.BAT      A backup program that uses the PKZIP file compression utility
  259.                 (created by Phil Katz of PKWare) to perform a quick and easy
  260.                 backup of your current directory.  This is ideal for people
  261.                 who wish to make safety copies of their work several times
  262.                 per day.  SAFE maintains up to three backups (in compressed
  263.                 form) on a diskette.  By using two or more diskettes in this
  264.                 way, you can have plenty of backups!  It's easy to use SAFE:
  265.                 whenever you take a coffee break, just type SAFE and walk
  266.                 away.  Now there's no reason to be without a backup!
  267.  
  268.                 NOTE:  The PKZIP utility is NOT included in the FORAGE
  269.                 package, but it can be found on almost any BBS in the world.
  270.                 You can also call our support BBS and download a fine
  271.                 freeware alternative to PKZIP, named LHA.  The batch file
  272.                 can then be modified to use that compression utility instead.
  273.  
  274.                 If you have PKZIP, you can use SAFE immediately.  Make sure
  275.                 that these files are in your DOS PATH:
  276.  
  277.                 --------- Included with FORAGE ---------     ---Other---
  278.                 FORAGE.EXE     SAFE.BAT,    PINNACLE.EXE     PKZIP.EXE
  279.                 GETKEY.EXE     SAFE2.BAT                     PKUNZIP.EXE
  280.                 ----------------------------------------     -----------
  281.  
  282.                 Then log to a directory on your hard disk.  Insert a blank
  283.                 diskette in the A: drive, then type SAFE at the DOS prompt.
  284.                 This will backup all files.  You can also back up a subset
  285.                 by entering a file mask.  For example:  SAFE *.DAT
  286.  
  287.   SAFE2.BAT     This batch file is called by SAFE.BAT
  288.  
  289.  
  290.  
  291. ===============================================================================
  292. LEGAL NOTICE
  293. ===============================================================================
  294.  
  295.  
  296. FORAGE  is presented on an  "as is"  basis,  with  no  warranties or guarantees
  297. expressed or implied.  The user bears complete responsibility for assessing the
  298. usefulness and applicability  of FORAGE to  his or her application.   Under  no
  299. circumstances will the author accept liability for any damages arising from the
  300. use or misuse of FORAGE or its accompanying files.
  301.  
  302.  
  303. ===============================================================================
  304. FREE USAGE AND SOURCE CODE
  305. ===============================================================================
  306.  
  307.  
  308. FORAGE is distributed as FREEWARE, which means that, while we retain full copy-
  309. right,  we  encourage you to use it -- at no cost -- and pass around  UNALTERED
  310. copies of the package. See the file VENDOR.DOC (included in the FORAGE package)
  311. for complete distribution details.
  312.  
  313. The Turbo Pascal source code for FORAGE may be purchased for in-house use only,
  314. for $25.  The nonexclusive  remarketing  license for FORAGE, which entitles you
  315. to market or distribute  the  FORAGE  program and documentation  (except source
  316. code) under a different name as your own product,  either as-is or modified, is
  317. $138 (source code is included in this price).  Remit payment by cheque or money
  318. order made out to Pinnacle Software. Make out cheque in U.S. or Canadian funds,
  319. drawn on a U.S. or Canadian bank.
  320.  
  321.  
  322. ===============================================================================
  323. THANK-YOU!
  324. ===============================================================================
  325.  
  326.  
  327. Thank-you for trying FORAGE!
  328.  
  329. If you find FORAGE useful, and you own a modem,  you can express your apprecia-
  330. tion by uploading a complete copy of FORAGE to your favourite BBS.  Once you've
  331. done that, consider FORAGE "paid for", and use it in good health!  If you DON'T
  332. own a modem, please give a good friend a copy to enjoy.
  333.  
  334. Please keep  FORAGE  together  with its  original  files.  If  your  package is
  335. incomplete, you can get a fresh copy from our  free files BBS,  along with some
  336. other great software.  You can reach our BBS at 514-345-8654, 24 hours per day,
  337. at up to 9600 bps (V32).   You can download as much as you want,  starting with
  338. your first call.   If you run out of time, call right back!  There is no charge
  339. for this service;  it's  our  way of  distributing  our  various  freeware  and
  340. shareware products.
  341.  
  342. For additional details, see the text file AMAZE.DOC.
  343.  
  344.